
Meteor.methods({
  getTime: function () {
  	var method = "POST";
  	var url = "http://192.168.56.1:6202/code_igniter/index.php/Welcome/getTime";
  	this.unblock();
  	try {
      // $.post(url); // jQuery is not allowed within server
  		// return new Date();
  		// return HTTP.call(method, url);
  		var content = HTTP.call(method, url);
  		var checkCode = parseInt(Math.random()*1000000);
  		if (checkCode<100000) {
  			checkCode += parseInt(Math.random()*10)*100000;
  		}
  		console.log(content);
  		console.log(checkCode);
  		// Session.set("checkCode", checkCode);
  		// TODO: Session只能用于Client端，要想保存10分钟内有效的数据，还需要用缓存系统
  		return content;
  	} catch(ex) {
  		console.log(ex);
  	}
  }
});;